package com.hoperun.product.view;

import java.util.Calendar;

import com.hoperun.yieldmgr.R;

import android.app.Dialog;
import android.os.Bundle;


import android.view.LayoutInflater;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.fragment.app.DialogFragment;

public class MyDatePickerDialog extends DialogFragment {

	private static final String CALENDAR = "calendar";

	/**
	 * dialog 实例化方法
	 * 
	 * @param calendar
	 *            日期
	 * @return DatePickerDialog
	 */
	public static MyDatePickerDialog newInstance(Calendar calendar) {
		MyDatePickerDialog dialog = new MyDatePickerDialog();
		Bundle bundle = new Bundle();
		bundle.putSerializable(CALENDAR, calendar);
		dialog.setArguments(bundle);
		return dialog;

	}

	@Override
	@NonNull
	public Dialog onCreateDialog(Bundle savedInstanceState) {
		// TODO Auto-generated method stub

		View view = LayoutInflater.from(getActivity()).inflate(
				R.layout.date_picker_dialog, null);
		// Dialog dialog = new Dialog(getActivity(), R.style.Mip_DialogStyle);
		Dialog dialog = new Dialog(getActivity(), R.style.Mip_DialogStyle);
		// 设置点击边际可消失
		dialog.setCanceledOnTouchOutside(true);
		dialog.setContentView(view);
		dialog.setTitle("请选择日期");

		// initDates(savedInstanceState);

		// initViews(view);

		// initListeners();

		return dialog;

	}
}
